{% extends "layout.html" %} {% import "macros/_macros.html" as macros %} {%- block content %}
<!-- Blog Post Content Column -->
<div class="container">
    <div class="row">
        <div class="col-lg-8">
            <!-- Blog Post -->
            <!-- Title -->
            <h1>{{post.title}}</h1>
            <!-- Author -->
            <p class="lead">
                by <a href="#">{{post.author.username}}</a>
            </p>
            <hr>
            <!-- Date/Time -->
            <p><span class="glyphicon glyphicon-time"></span>{{post.created_date.strftime('%Y-%m-%d %H:%M:%S %p')}}</p>
            <hr>
            <!-- Post Content -->
            <!--<p class="lead">{{post.main_content}}</p>-->
            <p>
                {{post.content|safe}}
            </p>
            <hr>
            <!-- Blog Comments -->
            <!-- Comments Form -->
            {% if current_user.can(Permission.COMMENT) %}
            <div class="well">
                <h4>Leave a Comment:</h4>
                <form action="" role="form" method=post class="form-horizontal">
                    {{ form.hidden_tag() }}
                    <div class="form-group">
                        {{form.body(class="form-control", rows="3")}}
                    </div>
                    <button type="submit" class="btn btn-primary">Submit</button>
                </form>
            </div>
            {%else%}
            <a href="{{url_for('blog.login')}}">Login to comment</a> or
            <a href="{{url_for('blog.signup')}}">Sign up</a> {%endif%}
            <hr>
            <!-- Posted Comments -->
            <!-- Comment -->
            {% include '_comments.html' %} {% if pagination %}
            <div class="pagination">
                {{ macros.pagination_widget(pagination, 'blog.post', fragment='#comments', id=post.id) }}
            </div>
            {% endif %}
        </div>
        {% include '_sidebar.html' %}
    </div>
</div>
{%- endblock %}
